// InstructionSet.cpp: implementation of the CInstructionSet class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "8085.h"
#include "InstructionSet.h"
#include "constants.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CInstructionSet::CInstructionSet()
{
    Init();
}

CInstructionSet::~CInstructionSet()
{

}

void CInstructionSet::Init()
{
    m_nLastIndex = 0;
    m_nNumberOfInstructions = 256;
}

int CInstructionSet::Search(char *s)
{
    if(*s=='\0')
        return -1;
       
    for(int i=0; i<m_nNumberOfInstructions ; i++)
        if(strcmpi(s,m_aInstructionSet[i].str)==0)
        {
            m_SLastLookedUp = &m_aInstructionSet[i];
            return m_nLastIndex=i;
        }
        return -1;
}

int CInstructionSet::Search(int x)
{
    if(x<0 || x>m_nNumberOfInstructions) return -1;
    
    m_SLastLookedUp = &m_aInstructionSet[x];
    return x;
}

CString
CInstructionSet::GetErrorPrefix()
{
    return CString(::nDebugPrefix?"InstructionSet ::" : "");
}

int CInstructionSet::Execute(byte opcode)
{
    return (this->*m_aInstructionSet[opcode].Execute)();
}


void CInstructionSet::ThrowException(severity s, the_exceptions e, const CString& str)
{
    throw CMyException(s,e,GetErrorPrefix()+str);
}

//////////////////////////////////////////////////////////////////////
// Initialization
//////////////////////////////////////////////////////////////////////
int CInstructionSet::m_nNumberOfInstructions=0;

CInstructionSet::SInstruction CInstructionSet::m_aInstructionSet[] = 
{ 

    //str,      display str, generic type,  specific type, len, opcode,execute,display function
    {"nop",		"nop"      , {control          , nop  ,		1,	0}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"lxi",		"lxi  b,"  , {data_transfer    , lxi ,		3,	1}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"stax", 	"stax b"   , {data_transfer    , stax ,		1,	2}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"inx",		"inx  b"   , {arith_and_logical, inx ,		1,	3}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  b"   , {arith_and_logical, inr ,		1,	4}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  b"   , {arith_and_logical, dcr ,		1,	5}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  b,"  , {arith_and_logical, mvi ,		2,	6}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"rlc",		"rlc  "    , {data_transfer    , rlc ,		1,	7}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {arith_and_logical, invalid,	1,	8}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"dad",		"dad  b"   , {data_transfer    , dad ,		1,	9}   ,&CInstructionSet::VKinvalid,  NULL    },
    {"ldax", 	"ldax b"   , {arith_and_logical, ldax ,		1,	10}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcx",		"dcx  b"   , {arith_and_logical, dcx ,		1,	11}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  c"   , {arith_and_logical, inr ,		1,	12}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  c"   , {data_transfer    , dcr ,		1,	13}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  c,"  , {arith_and_logical, mvi ,		2,	14}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"rrc",		"rrc"      , {data_transfer    , rrc  ,		1,	15}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	16}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"lxi",		"lxi  d,"  , {data_transfer    , lxi ,		3,	17}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"stax", 	"stax d"   , {arith_and_logical, stax ,		1,	18}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inx",		"inx  d"   , {arith_and_logical, inx ,		1,	19}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  d"   , {arith_and_logical, inr ,		1,	20}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  d"   , {arith_and_logical, dcr ,		1,	21}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  d,"  , {data_transfer    , mvi ,		2,	22}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"ral",		"ral"      , {arith_and_logical, ral  ,		1,	23}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	24}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dad",		"dad  d"   , {data_transfer    , dad ,		1,	25}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"ldax", 	"ldax d"   , {data_transfer    , ldax ,		1,	26}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcx",		"dcx  d"   , {arith_and_logical, dcx ,		1,	27}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  e"   , {arith_and_logical, inr ,		1,	28}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  e"   , {arith_and_logical, dcr ,		1,	29}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  e,"  , {data_transfer    , mvi ,		2,	30}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"rar",		"rar"      , {arith_and_logical, rar  ,		1,	31}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"rim",		"rim"      , {data_transfer    , rim  ,		1,	32}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"lxi",		"lxi  h,"  , {data_transfer    , lxi ,		3,	33}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"shld", 	"shld "    , {data_transfer    , shld ,		3,	34}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inx",		"inx  h"   , {arith_and_logical, inx ,		1,	35}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  h"   , {arith_and_logical, inr ,		1,	36}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  h"   , {arith_and_logical, dcr ,		1,	37}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  h,"  , {data_transfer    , mvi ,		2,	38}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"daa",		"daa"      , {arith_and_logical, daa  ,		1,	39}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	40}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dad",		"dad  h"   , {arith_and_logical, dad ,		1,	41}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"lhld", 	"lhld "    , {data_transfer    , lhld ,		3,	42}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcx",		"dcx  h"   , {arith_and_logical, dcx ,		1,	43}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  l"   , {arith_and_logical, inr ,		1,	44}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  l"   , {arith_and_logical, dcr ,		1,	45}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  l,"  , {data_transfer    , mvi ,		2,	46}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"cma",		"cma"      , {arith_and_logical, cma  ,		1,	47}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"sim",		"sim"      , {data_transfer    , sim  ,		1,	48}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"lxi",		"lxi  sp," , {data_transfer    , lxi ,		3,	49}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"sta",		"sta  "    , {data_transfer    , sta ,		3,	50}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inx",		"inx  sp"  , {arith_and_logical, inx ,		1,	51}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  m"   , {arith_and_logical, inr ,		1,	52}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  m"   , {arith_and_logical, dcr ,		1,	53}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  m,"  , {data_transfer    , mvi ,		2,	54}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"stc",		"stc"      , {arith_and_logical, stc  ,		1,	55}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	56}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dad",		"dad  sp"  , {arith_and_logical, dad ,		1,	57}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"lda",		"lda  "    , {data_transfer    , lda ,		3,	58}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcx",		"dcx  sp"  , {arith_and_logical, dcx ,		1,	59}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"inr",		"inr  a"   , {arith_and_logical, inr ,		1,	60}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"dcr",		"dcr  a"   , {arith_and_logical, dcr ,		1,	61}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mvi",		"mvi  a,"  , {data_transfer    , mvi ,		2,	62}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmc",		"cmc"      , {arith_and_logical, cmc  ,		1,	63}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,b" , {data_transfer    , mov ,		1,	64}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,c" , {data_transfer    , mov ,		1,	65}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,d" , {data_transfer    , mov ,		1,	66}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,e" , {data_transfer    , mov ,		1,	67}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,h" , {data_transfer    , mov ,		1,	68}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,l" , {data_transfer    , mov ,		1,	69}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,m" , {data_transfer    , mov ,		1,	70}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  b,a" , {data_transfer    , mov ,		1,	71}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,b" , {data_transfer    , mov ,		1,	72}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,c" , {data_transfer    , mov ,		1,	73}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,d" , {data_transfer    , mov ,		1,	74}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,e" , {data_transfer    , mov ,		1,	75}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,h" , {data_transfer    , mov ,		1,	76}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,l" , {data_transfer    , mov ,		1,	77}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,m" , {data_transfer    , mov ,		1,	78}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  c,a" , {data_transfer    , mov ,		1,	79}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,b" , {data_transfer    , mov ,		1,	80}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,c" , {data_transfer    , mov ,		1,	81}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,d" , {data_transfer    , mov ,		1,	82}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,e" , {data_transfer    , mov ,		1,	83}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,h" , {data_transfer    , mov ,		1,	84}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,l" , {data_transfer    , mov ,		1,	85}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,m" , {data_transfer    , mov ,		1,	86}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  d,a" , {data_transfer    , mov ,		1,	87}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,b" , {data_transfer    , mov ,		1,	88}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,c" , {data_transfer    , mov ,		1,	89}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,d" , {data_transfer    , mov ,		1,	90}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,e" , {data_transfer    , mov ,		1,	91}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,h" , {data_transfer    , mov ,		1,	92}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,l" , {data_transfer    , mov ,		1,	93}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,m" , {data_transfer    , mov ,		1,	94}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  e,a" , {data_transfer    , mov ,		1,	95}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,b" , {data_transfer    , mov ,		1,	96}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,c" , {data_transfer    , mov ,		1,	97}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,d" , {data_transfer    , mov ,		1,	98}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,e" , {data_transfer    , mov ,		1,	99}  ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,h" , {data_transfer    , mov ,		1,	100} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,l" , {data_transfer    , mov ,		1,	101} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,m" , {data_transfer    , mov ,		1,	102} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  h,a" , {data_transfer    , mov ,		1,	103} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,b" , {data_transfer    , mov ,		1,	104} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,c" , {data_transfer    , mov ,		1,	105} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,d" , {data_transfer    , mov ,		1,	106} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,e" , {data_transfer    , mov ,		1,	107} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,h" , {data_transfer    , mov ,		1,	108} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,l" , {data_transfer    , mov ,		1,	109} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,m" , {data_transfer    , mov ,		1,	110} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  l,a" , {data_transfer    , mov ,		1,	111} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,b" , {data_transfer    , mov ,		1,	112} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,c" , {data_transfer    , mov ,		1,	113} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,d" , {data_transfer    , mov ,		1,	114} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,e" , {data_transfer    , mov ,		1,	115} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,h" , {data_transfer    , mov ,		1,	116} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,l" , {data_transfer    , mov ,		1,	117} ,&CInstructionSet::VKinvalid,  NULL    },
    {"hlt",		"hlt"      , {data_transfer    , hlt  ,		1,	118} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  m,a" , {data_transfer    , mov ,		1,	119} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,b" , {data_transfer    , mov ,		1,	120} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,c" , {data_transfer    , mov ,		1,	121} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,d" , {data_transfer    , mov ,		1,	122} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,e" , {data_transfer    , mov ,		1,	123} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,h" , {data_transfer    , mov ,		1,	124} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,l" , {data_transfer    , mov ,		1,	125} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,m" , {data_transfer    , mov ,		1,	126} ,&CInstructionSet::VKinvalid,  NULL    },
    {"mov",		"mov  a,a" , {data_transfer    , mov ,		1,	127} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  b"   , {arith_and_logical, add ,		1,	128} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  c"   , {arith_and_logical, add ,		1,	129} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  d"   , {arith_and_logical, add ,		1,	130} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  e"   , {arith_and_logical, add ,		1,	131} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  h"   , {arith_and_logical, add ,		1,	132} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  l"   , {arith_and_logical, add ,		1,	133} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  m"   , {arith_and_logical, add ,		1,	134} ,&CInstructionSet::VKinvalid,  NULL    },
    {"add",		"add  a"   , {arith_and_logical, add ,		1,	135} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  b"   , {arith_and_logical, adc ,		1,	136} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  c"   , {arith_and_logical, adc ,		1,	137} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  d"   , {arith_and_logical, adc ,		1,	138} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  e"   , {arith_and_logical, adc ,		1,	139} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  h"   , {arith_and_logical, adc ,		1,	140} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  l"   , {arith_and_logical, adc ,		1,	141} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  m"   , {arith_and_logical, adc ,		1,	142} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adc",		"adc  a"   , {arith_and_logical, adc ,		1,	143} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  b"   , {arith_and_logical, sub ,		1,	144} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  c"   , {arith_and_logical, sub ,		1,	145} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  d"   , {arith_and_logical, sub ,		1,	146} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  e"   , {arith_and_logical, sub ,		1,	147} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  h"   , {arith_and_logical, sub ,		1,	148} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  l"   , {arith_and_logical, sub ,		1,	149} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  m"   , {arith_and_logical, sub ,		1,	150} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sub",		"sub  a"   , {arith_and_logical, sub ,		1,	151} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  b"   , {arith_and_logical, sbb ,		1,	152} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  c"   , {arith_and_logical, sbb ,		1,	153} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  d"   , {arith_and_logical, sbb ,		1,	154} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  e"   , {arith_and_logical, sbb ,		1,	155} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  h"   , {arith_and_logical, sbb ,		1,	156} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  l"   , {arith_and_logical, sbb ,		1,	157} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  m"   , {arith_and_logical, sbb ,		1,	158} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbb",		"sbb  a"   , {arith_and_logical, sbb ,		1,	159} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  b"   , {arith_and_logical, ana ,		1,	160} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  c"   , {arith_and_logical, ana ,		1,	161} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  d"   , {arith_and_logical, ana ,		1,	162} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  e"   , {arith_and_logical, ana ,		1,	163} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  h"   , {arith_and_logical, ana ,		1,	164} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  l"   , {arith_and_logical, ana ,		1,	165} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  m"   , {arith_and_logical, ana ,		1,	166} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ana",		"ana  a"   , {arith_and_logical, ana ,		1,	167} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  b"   , {arith_and_logical, xra ,		1,	168} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  c"   , {arith_and_logical, xra ,		1,	169} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  d"   , {arith_and_logical, xra ,		1,	170} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  e"   , {arith_and_logical, xra ,		1,	171} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  h"   , {arith_and_logical, xra ,		1,	172} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  l"   , {arith_and_logical, xra ,		1,	173} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  m"   , {arith_and_logical, xra ,		1,	174} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xra",		"xra  a"   , {arith_and_logical, xra ,		1,	175} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  b"   , {arith_and_logical, ora ,		1,	176} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  c"   , {arith_and_logical, ora ,		1,	177} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  d"   , {arith_and_logical, ora ,		1,	178} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  e"   , {arith_and_logical, ora ,		1,	179} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  h"   , {arith_and_logical, ora ,		1,	180} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  l"   , {arith_and_logical, ora ,		1,	181} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  m"   , {arith_and_logical, ora ,		1,	182} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ora",		"ora  a"   , {arith_and_logical, ora ,		1,	183} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  b"   , {arith_and_logical, cmp ,		1,	184} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  c"   , {arith_and_logical, cmp ,		1,	185} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  d"   , {arith_and_logical, cmp ,		1,	186} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  e"   , {arith_and_logical, cmp ,		1,	187} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  h"   , {arith_and_logical, cmp ,		1,	188} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  l"   , {arith_and_logical, cmp ,		1,	189} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  m"   , {arith_and_logical, cmp ,		1,	190} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cmp",		"cmp  a"   , {arith_and_logical, cmp ,		1,	191} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rnz",		"rnz"      , {data_transfer    , rnz  ,		1,	192} ,&CInstructionSet::VKinvalid,  NULL    },
    {"pop",		"pop  b"   , {data_transfer    , pop ,		1,	193} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jnz",		"jnz  "    , {data_transfer    , jnz ,		3,	194} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jmp",		"jmp  "    , {data_transfer    , jmp ,		3,	195} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cnz",		"cnz  "    , {data_transfer    , cnz ,		3,	196} ,&CInstructionSet::VKinvalid,  NULL    },
    {"push", 	"push b"   , {data_transfer    , push ,		1,	197} ,&CInstructionSet::VKinvalid,  NULL    },
    {"adi",		"adi  "    , {data_transfer    , adi ,		2,	198} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  0"   , {data_transfer    , rst ,		1,	199} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rz",		"rz"       , {data_transfer    , rz	,		1,	200} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ret",		"ret"      , {data_transfer    , ret  ,		1,	201} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jz",		"jz "      , {data_transfer    , jz ,		3,	202} ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	203} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cz",		"cz   "    , {data_transfer    , cz ,		3,	204} ,&CInstructionSet::VKinvalid,  NULL    },
    {"call", 	"call "    , {data_transfer    , call ,		3,	205} ,&CInstructionSet::VKinvalid,  NULL    },
    {"aci",		"aci  "    , {data_transfer    , aci ,		2,	206} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  1"   , {data_transfer    , rst ,		1,	207} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rnc",		"rnc"      , {data_transfer    , rnc  ,		1,	208} ,&CInstructionSet::VKinvalid,  NULL    },
    {"pop",		"pop  d"   , {data_transfer    , pop ,		1,	209} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jnc",		"jnc  "    , {data_transfer    , jnc ,		3,	210} ,&CInstructionSet::VKinvalid,  NULL    },
    {"out",		"out  "    , {data_transfer    , out ,		2,	211} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cnc",		"cnc  "    , {data_transfer    , cnc ,		3,	212} ,&CInstructionSet::VKinvalid,  NULL    },
    {"push", 	"push d"   , {data_transfer    , push ,		1,	213} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sui",		"sui  "    , {data_transfer    , sui ,		2,	214} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  2"   , {data_transfer    , rst ,		1,	215} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rc",		"rc"       , {data_transfer    , rc	,		1,	216} ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	217} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jc",		"jc   "    , {data_transfer    , jc ,		3,	218} ,&CInstructionSet::VKinvalid,  NULL    },
    {"in",		"in   "    , {data_transfer    , in ,		2,	219} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cc",		"cc   "    , {data_transfer    , cc ,		3,	220} ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	221} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sbi",		"sbi  "    , {data_transfer    , sbi ,		2,	222} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  3"   , {data_transfer    , rst ,		1,	223} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rpo",		"rpo"      , {data_transfer    , rpo  ,		1,	224} ,&CInstructionSet::VKinvalid,  NULL    },
    {"pop",		"pop  h"   , {data_transfer    , pop ,		1,	225} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jpo",		"jpo  "    , {data_transfer    , jpo ,		3,	226} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xthl", 	"xthl"     , {data_transfer    , xthl  , 	1,	227} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cpo",		"cpo  "    , {data_transfer    , cpo ,		3,	228} ,&CInstructionSet::VKinvalid,  NULL    },
    {"push", 	"push h"   , {data_transfer    , push ,		1,	229} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ani",		"ani  "    , {data_transfer    , ani ,		2,	230} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  4"   , {data_transfer    , rst ,		1,	231} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rpe",		"rpe"      , {data_transfer    , rpe  ,		1,	232} ,&CInstructionSet::VKinvalid,  NULL    },
    {"pchl", 	"pchl"     , {data_transfer    , pchl  , 	1,	233} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jpe",		"jpe "     , {data_transfer    , jpe ,		3,	234} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xchg", 	"xchg"     , {data_transfer    , xchg  , 	1,	235} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cpe",		"cpe  "    , {data_transfer    , cpe ,		3,	236} ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	237} ,&CInstructionSet::VKinvalid,  NULL    },
    {"xri",		"xri  "    , {data_transfer    , xri ,		2,	238} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  5"   , {data_transfer    , rst ,		1,	239} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rp",		"rp "      , {data_transfer    , rp ,		1,	240} ,&CInstructionSet::VKinvalid,  NULL    },
    {"pop",		"pop psw"  , {data_transfer    , pop ,		1,	241} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jp",		"jp "      , {data_transfer    , jp ,		3,	242} ,&CInstructionSet::VKinvalid,  NULL    },
    {"di",		"di"       , {data_transfer    , di	,		1,	243} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cp",		"cp   "    , {data_transfer    , cp ,		3,	244} ,&CInstructionSet::VKinvalid,  NULL    },
    {"push", 	"push psw ", {data_transfer    , push ,		1,	245} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ori",		"ori  "    , {data_transfer    , ori ,		2,	246} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  6"   , {data_transfer    , rst ,		1,	247} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rm",		"rm "      , {data_transfer    , rm ,		1,	248} ,&CInstructionSet::VKinvalid,  NULL    },
    {"sphl", 	"sphl"     , {data_transfer    , sphl  , 	1,	249} ,&CInstructionSet::VKinvalid,  NULL    },
    {"jm",		"jm "      , {data_transfer    , jm ,		3,	250} ,&CInstructionSet::VKinvalid,  NULL    },
    {"ei",		"ei"       , {data_transfer    , ei	,		1,	251} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cm",		"cm  "     , {data_transfer    , cm ,		3,	252} ,&CInstructionSet::VKinvalid,  NULL    },
    {"",        "invalid"  , {data_transfer    , invalid,	1,	253} ,&CInstructionSet::VKinvalid,  NULL    },
    {"cpi",		"cpi  "    , {data_transfer    , cpi ,		2,	254} ,&CInstructionSet::VKinvalid,  NULL    },
    {"rst",		"rst  7"   , {data_transfer    , rst ,		1,	255} ,&CInstructionSet::VKinvalid,  NULL    },
};

char CInstructionSet::m_szGlobalString[] = "Invalid";